package com.xsmart.oa.api;

import com.xsmart.common.entity.RequestBean;
import com.xsmart.common.entity.ResponseBean;
import com.xsmart.oa.services.MemberService;
import org.apache.catalina.servlet4preview.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/api/")
public class MemberController {

    @Autowired
    MemberService memberService;

    @RequestMapping(value = "/v1/MemberService/queryUserList", method = RequestMethod.POST)
    @ResponseBody
    public Object queryUserList(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return memberService.queryUserList(requestBean);
    }

    @RequestMapping(value = "/v1/MemberService/deleteUser", method = RequestMethod.POST)
    @ResponseBody
    public Object deleteUser(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return memberService.deleteUser(requestBean);
    }

    @RequestMapping(value = "/v1/MemberService/updateUser", method = RequestMethod.POST)
    @ResponseBody
    public Object updateUser(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return memberService.updateUser(requestBean);
    }

}
